<template>
<div>
  <div class="fullpage">
    <img src="/static/img/loginBg.png" alt="">
    <button open-type="getUserInfo" @getuserinfo="getUserInfo" class="login">登录</button>
  </div>

</div>
</template>
<script>
import request from '@/actions/request.js'
import localStroage from '@/actions/localStorage.js'
export default {
  data () {
    return {
      isLogin:false,
    }
  },

  components: {
  },
  watch: {

  },
  onShow(){
    this.isLogin=false;
  },
  methods: {
    // bindViewTap () {
    //   const url = '/pages/logs/main?id=1'
    //   wx.navigateTo({ url })
    // },
    getUserInfo () {
      // 调用登录接口
      wx.login({
        success: (data) => {
          wx.getUserInfo({
            withCredentials:true,
            success:(res)=>{
              this.isLogin=false;
              wx.switchTab({
                url:'../home/main'
              })
              request.getWxLogin('api/index/getWxUser', 'post', {code:data.code,encryptedData:res.encryptedData,iv:res.iv}, {}, false, this)
            },
            fail:(res)=>{
              this.isLogin=true;
            }
          });
        }
      })
    },
  },
  created () {
    // 调用应用实例的方法获取全局数据
    this.getUserInfo();
  },
  mounted () {
  }
}
</script>

<style scoped lang="scss">
  .fullpage{
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    img{
      width: 100vw;
      height: 101vh;
    }
    button{
      top:75vh;
      left: 14vw;
      width: 72vw;
      height:12vw;
      border-radius: 10vw;
      font-family:PingFang-SC-Regular;
      color:rgba(255,60,100,1);
      font-size: 20px;
      margin: 0px auto;
      line-height: 12vw;
      position: absolute;
    }
   /* .inside{
      width: 92vw;
      height:85vh;
      margin: 0px auto;
      background: #fff;
      -webkit-border-radius: 5vw;
      -moz-border-radius: 5vw;
      border-radius: 5vw;
      padding-top: 25vw;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      .imgBox{
        width: 18vw;
        height: 30vw;
        margin: 0px auto;
        p{
          text-align: center;
          color: #333;
          font-size: 18px;
        }
        img{
          width: 17.33vw;
          height:17.33vw;
        }
      }
      button{
        width: 60%;
        height: 10vw;
        border-radius: 10vw;
        background: #FF3C64;
        color: #fff;
        margin-top: 17vw;
        line-height: 10vw;
      }
    }*/
  }
</style>
